Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine permissions #75

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smokestacklightnin
Copy link
Contributor

@smokestacklightnin smokestacklightnin commented Nov 4, 2024

This is an interim solution (in lieu of redesigning the entire IAM permissions infrastructure) that adds finer-grained permissions for the AWS services (s3, ec2, ecr, dynamoDB, etc.).

The permissions were generated by downloading the AWS event history as a csv file and running the following script (converted from a Jupyter notebook):

#!/usr/bin/env python
# coding: utf-8

# In[1]:


import pandas as pd


# In[2]:


df = pd.read_csv("event_history.csv")
df = df[(df["User name"] == "GitHubActions") | (df["User name"] == "[email protected]")]


# In[3]:


df = df[["Event source", "Event name"]]
gb = df.groupby(by=["Event source", "Event name"], as_index=False).count()


# In[4]:


output = gb.apply(lambda r: ":".join((r["Event source"].split(".")[0], r["Event name"])), axis=1)


# In[5]:


output.to_json("permissions_used.json", orient="records")

If the permissions here are not sufficient, an administrator can individually add any that are missing to web/deploy/terraform/modules/iam/policies/gha-policy.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant